﻿module Lhz.Page.DataView {
    export class ServiceDetailView extends DetailPage<Lhz.Entity.ServiceCenter.Service> {
        constructor() {
            super({
                serviceNo: "service",
                mappingOptionsArray: [
                    { propertyName: "No", selector: "[name=No]" },
                    { propertyName: "Name", selector: "[name=Name]" },
                    { propertyName: "Url", selector: "[name=Url]" },
                    { propertyName: "Description", selector: "[name=Description]" }
                ],
                initialized: function (dp) {
                    new ManagementPage<Lhz.Entity.ServiceCenter.Operation>({
                        serviceNo: "operation",
                        queryOperationNo: "queryByUserGuidAndServiceGuid",
                        getQueryArguments: function (mp) {
                            return [mp.user.Guid, mp.getDialogArguments().item.Guid, []];
                        },
                        getDetailArguments: function (mp, selectedItem) {
                            return {
                                item: selectedItem,
                                dbOperation: false
                            };
                        },
                        targetName: "操作",
                        editOperationName: "查看",
                        colModel: [
                            { title: "名称", dataIndx: "Name", width: "200", align: "center" },
                            { title: "编号", dataIndx: "No", width: "200", align: "center" },
                            { title: "描述", dataIndx: "Description", width: "300" }
                        ],
                        detailPageUrl: "operation-view-detail.html",
                        width: 400,
                        height: 200,
                        data: dp.item.Operations,
                        getItemName: function (mp, item) {
                            return item.Name;
                        }
                    });
                }
            });
        }
    }
    $(function () {
        new ServiceDetailView();
    });
}
